/*
 * BanBu_PurchaseRecordCell
 * @description 本文件提供表情购买记录界面的定制cell
 * @package
 * @author 		***
 * @copyright
 * @version 		1.0
 * @description 本文件提供表情购买记录界面的定制cell
 */

#import "BanBu_PurchaseRecordCell.h"
#import "UIImageView+WebCache.h"
#import "AppCommunicationManager.h"
#import "AppDataManager.h"
#import "BanBu_SmileViewAPI.h"
#import "BanBu_ImageView.h"
#import "BanBu_ThemeManager.h"

@implementation BanBu_PurchaseRecordCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {

        _limitLabel.text = [NSString stringWithFormat:@"%@%@",NSLocalizedString(@"limit_use", nil),NSLocalizedString(@"limit_never", nil)];
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)dealloc
{
    [_faceImageView release];
    [_nameLabel release];
    [_timaLabel release];
    [_feeStateLabel release];
    [_limitLabel release];
    [super dealloc];
}

-(void)setBg
{
//    BanBu_ImageView *backImage = [[BanBu_ImageView alloc] initWithBackGroundImageType:UIImageViewCreatTypeCell];
//    backImage.frame = CGRectMake(0, 0, 320, 81);
//    self.backgroundView = backImage;
//    [backImage release];
    
    lineView = [[UIImageView alloc] initWithFrame:CGRectMake(-40, 80, 360, 1.0)];
    lineView.image = [ThemeManager getThemeImage:@"lineColor.png"];
    [self.contentView addSubview:lineView];
    [lineView release];
}

//设置表情属性
-(void)setEmoInfo:(NSDictionary *)emoInfoDic
{
    _limitLabel.text = [NSString stringWithFormat:@"%@%@",NSLocalizedString(@"limit_use", nil),NSLocalizedString(@"limit_never", nil)];
    //表情封面
    NSString * imageName = @"1.gif";
    NSString * imageUrl = [NSString stringWithFormat:@"%@%@",[emoInfoDic valueForKey:KeyPath],imageName];
    [_faceImageView setImageWithUrlString:imageUrl withFolderName:[AppComManager remove_:[emoInfoDic valueForKeyPath:Keyid]] withImageName:imageName];
    
    _nameLabel.text = [emoInfoDic valueForKey:KeyName];
    
    NSString * timeStr = [emoInfoDic valueForKey:KeyDownloadTime];
    
    _timaLabel.text = [timeStr substringToIndex:10];
    
    if (![[emoInfoDic valueForKey:KeyFeeState] boolValue])
    {
        _feeStateLabel.text = NSLocalizedString(@"free", nil);
    }
    else
    {
        _feeStateLabel.text = [emoInfoDic valueForKey:KeyFee];
    }
}
@end
